import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/oauth/token?grant_type=password&scope=all&client_id=client&client_secret=secret',
    method: 'get',
    params: data
})

  // return new Promise((resolve) => {
  //   resolve({
  //     code: 20000,
  //     data: { token: "9d4e2a42-93bd-421a-8e0f-969d7bfc198f" }
  //   })
  // })
}

export function getInfo(token) {
  return request({
    url: '/vue-element-admin/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}


export function addnewUser(query) {
  return request({
      url: '/user',
      method: 'post',
      data: query
  })
}

export function getUserlist(query) {
  return request({
    url: '/users/search/1',
    method: 'get',
    params: query
  })
}
export function putUserlist(query) {
  return request({
    url: '/user',
    method: 'put',
    data: query
  })
}
export function deleteUser(query) {
  return request({
    url: '/users/logic',
    method: 'delete',
    data: query
  })
}

